package com.meta.nd.controller;



import com.meta.nd.service.DbMapService;
import com.meta.nd.vo.Nv;
import com.meta.nd.vo.RequestMessage;
import com.meta.nd.vo.ReturnMessage;
import com.meta.util.ExceptionUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
public class DbMapController {
	@Resource
	DbMapService dbMapService;
	@RequestMapping(value = "/dbmap/createDefaultDbMapNv", method = { RequestMethod.POST })
	public ReturnMessage<Nv> createDefaultDbMapNv(@RequestBody RequestMessage<String> requestMessage) {
		try {
			String ndCode = requestMessage.getValue();
			Nv nv  = this.dbMapService.createDefaultDbMapNv(ndCode);
			return  new ReturnMessage<Nv> (true,null,nv );
		}catch ( Exception e ) {
			log.error(e.getMessage(),e);
			return ExceptionUtils.buildReturnMessage(e);
		}
	}
}
